import logging
class Sample:
    def __init__(self):
        self.time=None
        self.sampleid=None
        self.mass=None
        self.beizhu=""
        self.num=0
        self.items={}
    def __repr__(self):
        return str(self.sampleid)+str(self.items)
    def __getattribute__(self, attr): #注意：attr是传入的属性名,不是属性值
        ws=attr.split("_")   #"_" is special char can not used in attr
        if len(ws)==2:
            (ele,wave)=ws
            return (self.items[(ele,wave)])
        return object.__getattribute__(self, attr) #返回属性名
    def __setattr__(self, attr,value): #注意：attr是传入的属性名,不是属性值
        # logging.info([attr,value])
        ws=attr.split("_")   #"_" is special char can not used in attr
        if len(ws)==2:
            (ele,wave)=ws
            self.items[(ele,wave)]=value
        return object.__setattr__(self, attr,value)

class SampleICP(Sample):
    def __init__(self):
        super().__init__()
        self.xishi=""
        pass